export interface FilterTimesRow {
    label: string
    value: string
}

export const getSearchParams = (type: string) => {
    const value: FilterTimesRow[] = getSearchFilters(type);
    let params: { [props: string]: string } = {};
    if (value) {
        for (let row of value) {
            params[row.value] = '';
        }
    }
    return params;
}

const SearchFiltersMember = [
    { value: 'mobile_keyword', label: '会员手机号' },
    { value: 'nickname_keyword', label: '会员昵称' },
    { value: 'member_sn_keyword', label: '会员卡号' },
]

export const getSearchFilters = (type: string): FilterTimesRow[] => {
    const filtersValue: { [props: string]: FilterTimesRow[] } = {
        member: SearchFiltersMember,
        integral: SearchFiltersMember,
        consume: [
            ...SearchFiltersMember,
            { value: 'transaction_id_keyword', label: '交易号' },
            { value: 'order_sn_keyword', label: '订单号' },
        ],
        memberGrouping: [
            { value: 'name_keyword', label: '群组名称' },
        ],
        logoutRecord: [
            { value: 'name_keyword', label: '群组名称' },
        ],
        coupon: [
            { value: 'name_keyword', label: '优惠券名称' },
            { value: 'id_keyword', label: '优惠券ID' },
            { value: 'shop_name_keyword', label: '店铺名称' },
        ],
        wxCoupon: [
            { value: 'name_keyword', label: '代金券名称' },
            { value: 'third_id_keyword', label: '批次ID' },
        ],
        goodsActivity: [
            { value: 'name_keyword', label: '商品名称' },
            { value: 'id_keyword', label: '商品ID' },
            { value: 'shop_name_keyword', label: '店铺名称' },
        ],
        pointGoods: [
            { value: 'name_keyword', label: '商品名称' },
            { value: 'id_keyword', label: '商品ID' },
        ],
        game: [
            { value: 'name_keyword', label: '活动名称' },
            { value: 'id_keyword', label: '活动ID' },
        ],
        exchangeOrder: [
            { value: 'order_sn_keyword', label: '订单号' },
            { value: 'item_id_keyword', label: '商品ID' },
            { value: 'item_name_keyword', label: '商品名称' },
            ...SearchFiltersMember,
        ],
        recommend: [
            { value: 'content_keyword', label: '笔记标题' },
            { value: 'id_keyword', label: '笔记ID' },
            { value: 'shop_name_keyword', label: '店铺名称' },
        ],
        senseSendCoupon: [
            { value: 'name_keyword', label: '发券计划名称' },
            { value: 'id_keyword', label: '发券计划ID' },
        ],
        downloadCenter: [
            { value: 'name_keyword', label: '任务名称' },
        ],
        ticketVerify: [
            { value: 'source_keyword', label: '订单号' },
            ...SearchFiltersMember,
            { value: 'sn_keyword', label: '审核编号' },
            { value: 'verified_by_keyword', label: '审核人' },
        ],
        parkCoupon: [
            { value: 'name_keyword', label: '停车名称' },
            { value: 'id_keyword', label: '停车ID' },
        ],
        parkForms: [
            ...SearchFiltersMember,
            { value: 'order_sn_keyword', label: '订单号' },
            { value: 'name_keyword', label: '缴费车牌' },
        ],
        warningRecord: SearchFiltersMember,
        shopManage: [
            { value: 'shop_name_keyword', label: '店铺名称' },
            { value: 'shop_id_keyword', label: '店铺ID' },
        ],
    }
    return filtersValue[type];
}